﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;

namespace FilesMerger2._0
{
    public class RowFormat : IEquatable<RowFormat>
    {
        public Color BackgroundColor { get; set; }

        public String Pattern { get; set; }

        #region Equality members

        public bool Equals(RowFormat other)
        {
            if (ReferenceEquals(null, other)) return false;
            if (ReferenceEquals(this, other)) return true;
            return BackgroundColor.Equals(other.BackgroundColor) && string.Equals(Pattern, other.Pattern);
        }

        public override bool Equals(object obj)
        {
            if (ReferenceEquals(null, obj)) return false;
            if (ReferenceEquals(this, obj)) return true;
            if (obj.GetType() != this.GetType()) return false;
            return Equals((RowFormat) obj);
        }

        public override int GetHashCode()
        {
            unchecked
            {
                return (BackgroundColor.GetHashCode()*397) ^ (Pattern != null ? Pattern.GetHashCode() : 0);
            }
        }

        public static bool operator ==(RowFormat left, RowFormat right)
        {
            return Equals(left, right);
        }

        public static bool operator !=(RowFormat left, RowFormat right)
        {
            return !Equals(left, right);
        }

        #endregion
    }
}
